var popupStatus = 0;//0 means disabled; 1 means enabled;  
var currentPopup;

function loadPopup(id){  
	if(popupStatus==0){  //loads popup only if it is disabled  
		$('.inputbox').hide();
		$('object').hide();
		$("#backgroundPopup").css({  
		"opacity": "0.7"  
 		});  
		$("#backgroundPopup").fadeIn("slow");  
 		$(id).fadeIn("slow");  
		popupStatus = 1;  
		currentPopup = id;
	}
}

function disablePopup(id){ 
	if(popupStatus==1){ //disables popup only if it is enabled 
		$("#backgroundPopup").fadeOut("slow"); 
		$(id).fadeOut("slow"); 
		popupStatus = 0; 
		currentPopup= "";
		$('object').show();
		$('.inputbox').show();
	} 
}
	
function centerPopup(id){  
	//request data for centering  
	var windowWidth = document.documentElement.clientWidth;  
	var windowHeight = document.documentElement.clientHeight;  
	var popupHeight = $(id).height();  
	var popupWidth = $(id).width();  
	var scrolled = $(document).scrollTop();
	//centering  
	$(id).css({  
		"position": "absolute",  
		"top": windowHeight/2-popupHeight/2+ scrolled,  
		"left": windowWidth/2-popupWidth/2,
		"z-index":1000
	});  
	//only need force for IE6  
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		$("#backgroundPopup").css({  
			"height": windowHeight,
			"top" : scrolled  
		});
	}  
}
